package com.itlong.cloud.sdk.resource;

import com.itlong.cloud.POJO.DTO.sdk.CloudElevatorSDKServerElevatorKeyDTO;
import com.itlong.cloud.equip.sdk.ICloudElevatorSDKRobotClient;
import com.itlong.cloud.sdk.service.ICloudElevatorSDKRobotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      云对讲SDK服务暴露接口实现类。
 * <desc/>
 *
 * @createDate 2018-05-17.
 */
@RestController
public class CloudElevatorSDKRobotResource implements ICloudElevatorSDKRobotClient {

    @Autowired
    ICloudElevatorSDKRobotService iCloudElevatorSDKRobotService;

    /**
     * <desc>
     *      查询云电梯唯一标识。
     * <desc/>
     *
     * @param  pageDTO 入参
     * @return
     * @author Qiang.S
     * @createDate 2018-12-28
     */
    @Override
    @RequestMapping(path = "/cloud/elevator/robotToItlong/getElevatorKey",method = RequestMethod.POST)
    public List<String> getElevatorKey(@RequestBody CloudElevatorSDKServerElevatorKeyDTO pageDTO) throws Exception{
        return iCloudElevatorSDKRobotService.getElevatorKey(pageDTO);
    }

    /**
     * <desc>
     *      查询当前机器人行程是否完成。
     * <desc/>
     *
     * @param  robotId 机器人编号
     * @param  deviceUnique 设备编号
     * @return
     * @author Qiang.S
     * @createDate 2020-03-27
     */
    @Override
    @RequestMapping(path = "/cloud/elevator/robotToItlong/checkSuccessState",method = RequestMethod.POST)
    public Integer checkSuccessState(@RequestParam("robotId") String robotId, @RequestParam("deviceUnique") String deviceUnique) throws Exception{
        return iCloudElevatorSDKRobotService.checkSuccessState(robotId,deviceUnique);
    }

    /**
     * <desc>
     *        查询机器人的单梯多梯权限
     * </desc>
     *
     * @param robotId 机器人id
     * @return 单体多梯标记map
     * @Author Zhu.yj
     * @createDate  2020/9/7
     */
    @Override
    @RequestMapping(value = "/cloud/elevator/robotToItlong/getElevatorFlag", method = RequestMethod.POST)
    public Map<String, Object> getElevatorFlag(@RequestParam("robotId") String robotId) throws Exception {
        return iCloudElevatorSDKRobotService.getElevatorFlag(robotId);
    }

}
